#include <bits/stdc++.h>
using namespace std;
const int P = 998244353;
int n, k, t, ans;
int fac[4000000], inv[4000000];
int power(int x, int y)
{
    int res = 1;
    while (y)
    {
        if (y & 1)
        {
            res = 1ll * res * x % P;
        }
        x = 1ll * x * x % P;
        y >>= 1;
    }
    return res;
}
int main()
{
    freopen("count.in", "r", stdin);
    freopen("count.out", "w", stdout);
    fac[0] = 1;
    for (int i = 1; i <= 2000000; i++)
    {
        fac[i] = 1ll * fac[i - 1] * i % P;
    }
    inv[2000000] = power(fac[2000000], P - 2);
    for (int i = 2000000; i; i--)
    {
        inv[i - 1] = 1ll * inv[i] * i % P;
    }
    scanf("%d%d", &n, &k);
    for (int i = 1, x; i <= n; i++)
    {
        scanf("%d", &x);
        if (x < t)
        {
            ans = (ans + P - 1) % P;
            break;
        }
        while (t < x)
        {
            ans = (ans + 1ll * fac[n - i + k - t - 1] * inv[k - t - 1] % P * inv[n - i]) % P;
            t++;
        }
    }
    printf("%d\n", ans);
    return 0;
}